package com.bw.common.bind;

import android.text.TextUtils;
import android.widget.ImageView;

import androidx.databinding.BindingAdapter;

import com.bw.imgload_sdk.LoadImgUtils;

import java.io.File;

import de.hdodenhof.circleimageview.CircleImageView;

public class ImageBind {

    @BindingAdapter(value = {"img"})
    public static void bindheadImg(CircleImageView imageView, String path){
        if (TextUtils.isEmpty(path)) {
            imageView.setImageResource(com.bw.widget_sdk.R.drawable.icon_user_name);
            return;
        }
        LoadImgUtils.loadMatchImg(path,imageView);
    }
    @BindingAdapter(value = {"selimg"})
    public static void bindSelImg(CircleImageView imageView, String path){
        if (TextUtils.isEmpty(path)) {
            imageView.setImageResource(com.bw.widget_sdk.R.drawable.icon_user_name);
            return;
        }
        LoadImgUtils.loadFileImg(new File(path),imageView);
    }
}
